<template>
	<view class="">
		<div class="homebj">
			<swiper style="width: 375px;height: 240px;" :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000">
				<swiper-item>
					<view style="width: 375px;height: 240px;" class="swiper-item">
						<image style="width: 375px;height: 240px;" :src="getImg1(datas.typeImg)">
					</view>
				</swiper-item>
			</swiper>
		    <!-- 单位详情标签 -->
		    <div class="danweixq">
		        <div class="hdbmall dwxqposition">
		            <div class="dwxqtitle">{{datas.name}}</div>
		            <div class="dwxqtag">
		                <div class="dwxqtaglsit" v-for="(el,ind) in datas.lables">{{el.name}}</div>
		            </div>
		        </div>
		    </div>
		    <!-- 单位详情地址 -->
		    <div class="hdbmall dwxqmargin">
		        <div class="hdbmlist" v-if="datas.headName != ''">
		            <image :src="getImg('hdxq_fzr-1.png')" class="dwxqfzrimg">
		            <div class="dwxqfzrtitle">负责人：{{datas.headName}}</div>
		        </div>
		        <div class="hdbmlist" v-if="datas.headPhone != ''">
		            <image :src="getImg('hdxq_dh-1.png')" class="dwxqfzrimg">
		            <div class="dwxqfzrtitle">负责人电话：{{datas.headPhone}}</div>
		        </div>
		        <div class="hdbmlist" v-if="datas.address != ''">
		            <image :src="getImg('hdxq_dz-1.png')" class="dwxqfzrimg">
		            <div class="dwxqfzrtitle">地址：{{datas.address}}</div>
		        </div>
		        <div class="hdbmlist" v-if="datas.des != ''" @click="xqclick">
		            <image :src="getImg('hdxq_xq-1.png')" class="dwxqfzrimg">
		            <image class="dwxqfzrtitleimg" :src="getImg('hdxq_xq-xia.png')" v-if="imgIshow">
		            <image class="dwxqfzrtitleimg" :src="getImg('hdxq_xq-shang.png')" v-if="!imgIshow">
		            <div class="dwxqfzrtitle">介绍：</div>
		            <div :class="[isicon?'ssss':'icon','dwxqfzrtitle' ,'active']" v-html="datas.des"></div>
		        </div>
		    </div>
		    <!-- 最新活动 -->
		    <div class="homermqnzj" v-if="datas.conList3.length > 0">
		        <div class="hometitle">最新活动</div>
		        <div class="homermqnzjall">
		            <div class="homermqnzjlist" v-for="(el,ind) in datas.conList3" @click="hdxqclick(el.id)" style="margin: 0px 0px 15px 0px">
		                <div class="homermqnzjleft dwxqleft">
		                    <image v-if="el.typeImg != ''" :src="getImg1(el.typeImg)" class="rmqnzjimg1">
		                    <image v-if="el.typeImg == ''" :src="getImg('noimg.png')" class="rmqnzjimg1">
		                    <image v-if="el.type == 0" :src="getImg('hdxqjxzicon.png')" class="rmqnzjimg2 dwxqwcimg">
		                    <image v-if="el.type == 1" :src="getImg('hdxqjxz.png')" class="rmqnzjimg2 dwxqwcimg">
		                    <image v-if="el.type == 2" :src="getImg('hdxqjxzactive.png')" class="rmqnzjimg2 dwxqwcimg">
		                </div>
		                <div class="homermqnzjright">
		                    <div class="homermqnzjname">{{el.name}}</div>
		                    <div class="sy-dizhi">负责人：{{el.header}}</div>
		                    <div class="dwxqmsdes">{{el.place}}</div>
		                    <div class="dwxqmsdtime">
		                        <div class="dwxqmsdtimename">{{el.start_time}}-{{el.end_time}}</div>
		                    </div>
		                </div>
		            </div>
		        </div>
		    </div>
		    <!-- 场馆列表 -->
		    <div class="homermqnzj" v-if="datas.conList1.length > 0">
		        <div class="hometitle">场馆列表</div>
		        <div class="homermqnzjall">
		            <div class="homermqnzjlist" v-for="(el,ind) in datas.conList1" @click="cgxqclick(el.id)" style="margin: 0px 0px 15px 0px">
		                <div class="homermqnzjleft dwxqleft">
		                    <image v-if="el.typeImg != ''" :src="getImg1(el.typeImg)" class="rmqnzjimg1">
		                    <image v-if="el.typeImg == ''" :src="getImg('noimg.png')" class="rmqnzjimg1">
		                </div>
		                <div class="homermqnzjright">
		                    <div class="homermqnzjname">{{el.name}}</div> 
		                    <div class="dwxqms-ms">{{el.description}}</div>
		                </div>
		            </div>
		        </div>
		    </div>
		    <div class="hometitle">
		        <div class="tit">热门评论</div>
		        <div class="ditu" style="border:1px solid #CCC"><div class="dtnn" @click="plclick(datas.waresId)">发表评论<image :src="getImg('ra-hd-icon-jiantou@2x.png')"></div></div>
		    </div>
		    <div class="hdbmall" v-if="pldatas.length <= 0" style="margin-bottom: 20px;padding: 20px;font-size: 12px;">暂无评论，快去点评吧！</div>
		    <div class="hdbmall " v-if="pldatas.length > 0" style="margin-bottom: 20px;">
		        <div class="hdbmlist" v-for="(el,ind) in pldatas">
		            <div class="yrxmdleft">
		                <image v-if="el.userImg != ''" :src="el.userImg" class="yrxmdimg">
		                <image v-if="el.userImg == ''" :src="getImg('touxiang.png')" class="yrxmdimg">
		            </div>
		            <div class="yrxmdright">
		                <div class="yrxmdname">{{el.name}}</div>
		                <div class="yrxmdtime">{{el.createTime}}</div>
		                <div class="dwxqcontent">{{el.content}}</div>
		            </div>
		        </div>
		        <div class="hdlcbottom yrxmdmargin" @click="ckxqclick(datas.waresId)" style="margin: 15px auto 0 auto">查看列表</div>
		    </div>
		</div>
	</view>
</template>

<script>
	import web from '../../components/utils/request.js'
	export default{
		data(){
			return{
				datas: {},
				sydatas: [],
				pldatas: [],
				imgIshow: true,
				isicon:true
			}
		},
		onLoad(options) {
			this.id=options.id;
		},
		onReady() {
			this.getData();
			this.getData1();
			this.getData2();
		},
		methods:{
			getImg(url) {
				return 'https://ruianm.tour-ma.com/r/cms/www/m/huodong/img/' + url;
			},
			getImg1(url) {
				return 'https://ruianm.tour-ma.com' + url;
			},
			getData(){
				var url = "/wareDateil.jspx";
				var arg = {id:this.id};
				var that=this;
				web.httpPost(that, url, arg, function(res) {
					that.datas = res.data.data;
				})
			},
			getData1(){
				var url = "/wareAllList.jspx";
				var arg = {lon:this.longitude,lat:this.latitude};
				var that=this;
				web.httpPost(that, url, arg, function(res) {
					that.sydatas = [];
					for (let i = 0; i < res.data.data.length; i++) {
					    if(that.id != res.data.data[i].waresId){
					        that.sydatas.push(res.data.data[i]);
					    }
					}
				})
			},
			getData2(){
				var url = "/commentsList.jspx";
				var arg = {wareId:this.id,pageNo:1,pageSize:5};
				var that=this;
				web.httpPost(that, url, arg, function(res) {
					 that.pldatas = res.data.data;
				})
			},
			hdxqclick: function(id) {//点击进入活动详情
				uni.navigateTo({
					url:'./hdxq?id=' + id
				})
			},
			dwxqclick: function(waresId) {//点击进入单位详情页
				uni.navigateTo({
					url:'./dwxq?id=' + waresId
				})
			},
			plclick: function(wareId) {//点击跳转评论页面
				uni.navigateTo({
					url:'./fbpl?wareId=' + wareId
				})
			},
			ckxqclick: function(wareId) {//点击跳转评论列表页面
				uni.navigateTo({
					url:'./pllb?wareId=' + wareId
				})
			},
			cgxqclick: function(id) {//点击跳转场馆预定
				uni.navigateTo({
					url:'./cgyd?id=' + id
				})
			},
			xqclick: function() {
				this.isicon=!this.isicon;
				console.log(this.isicon)
				this.$forceUpdate()
			    // $('.dwxqfzrtitle.active').toggleClass("icon");
			    this.imgIshow = !this.imgIshow;
			}
		}
	}
</script>

<style>
	@import url("@/components/css/datascss.css");
</style>
